<!-- 仓库材料关系详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="storeMaterialModalApp.storeMaterial"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="storeMaterialModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ storeMaterialModalApp.storeMaterial.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ storeMaterialModalApp.storeMaterial.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ storeMaterialModalApp.storeMaterial.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="材料id">
                        {{ storeMaterialModalApp.storeMaterial.materialId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="库存数量">
                        {{ storeMaterialModalApp.storeMaterial.quantity }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="价格">
                        {{ storeMaterialModalApp.storeMaterial.price }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="订单状态">
                        {{ storeMaterialModalApp.storeMaterial.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ storeMaterialModalApp.storeMaterial.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ storeMaterialModalApp.storeMaterial.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ storeMaterialModalApp.storeMaterial.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {StoreMaterialService} from "@/views/restaurant/material/storeMaterial/storeMaterialService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let storeMaterialListApp = inject('storeMaterialListApp', reactive({}));
            const storeMaterialModalApp = reactive({id: null, storeMaterial: {}, display: false});

            onMounted(() => {
                    storeMaterialModalApp.storeMaterial = {};
                if (routeId) {
                        storeMaterialModalApp.id = routeId;
                } else if (storeMaterialListApp.viewModalShowing) {
                        storeMaterialModalApp.id = storeMaterialListApp.currentId;
                        storeMaterialModalApp.display = true;
                }
                if (storeMaterialModalApp.id) {
                    getInfo(storeMaterialModalApp.id);
                }
            })

            const getInfo = (id) => {
              console.log("sssss")
                    StoreMaterialService.findStoreMaterial(id).then((res) => {
                            storeMaterialModalApp.storeMaterial = res.data;
                            storeMaterialModalApp.title = "查看 " + storeMaterialModalApp.storeMaterial.name;
                })
            }

            return {
                    storeMaterialModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

